package com.kly.smartbi.test.day09;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.util.*;

/**
 * @author admin
 * @date 2025/4/11
 */
public class Demo1 {

    public static void main(String[] args) {
        BigNum();
    }

    /**
     * 计算大数
     */
    public static void BigNum() {
        BigInteger a = new BigInteger("1000000007");

        BigInteger b1 = new BigInteger("9");
        b1 = b1.pow(10000);

        BigInteger b2 = new BigInteger("8");
        b2 = b2.pow(10000).multiply(BigInteger.valueOf(2));

        BigInteger b3 = new BigInteger("7");
        b3 = b3.pow(10000);

        BigInteger mod = b1.subtract(b2).add(b3).mod(a);
        System.out.println(mod);

    }


    /**
     * 二进制，四进制转换
     */
    public static int binaryToFour(int a, int b) {
        int sum = 0;
        while(a > 0) {
            sum += a % b;
            a /= b;
        }
        return sum;
    }



    /**
     * 分糖果
     */
    public static void candy() {
        Scanner scan = new Scanner(System.in);
        // 在此输入您的代码...
        int a = scan.nextInt();
        int b = scan.nextInt();
        int[] records = new int[26];
        String str = scan.next();
        char[] charArray = str.toCharArray();
        int len = charArray.length;
        for (char c : charArray) {
            records[c - 'a']++;
        }

        for (int i = 0; i < len; ) {
            if (records[i] > 0) {
                records[i]--;
                b--;
            } else {
                i++;
            }
        }

        // 输出字符串
        StringBuilder sb = new StringBuilder();
        for (int i : records) {
            if (i > 0) {
                sb.append((char) (i + 'a'));
            }
        }
        System.out.println(sb.toString());

        scan.close();
    }

    /**
     * 判断是不是回文
     */
    public static boolean isString(String str) {
        StringBuilder sb = new StringBuilder(str);
        if (str.equals(sb.reverse().toString())) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * 排序
     *
     * @param
     * @return
     */
    public static void sort(int[] nums) {
        Scanner scan = new Scanner(System.in);
        // 在此输入您的代码...
        int len = scan.nextInt();
        Long[] arr = new Long[len];
        for (int i = 0; i < len; i++) {
            long num = scan.nextLong();
            arr[i] = num;
        }
        // 排序
        Arrays.sort(arr, (a, b) -> {
            int a1 = getNum(a);
            int b1 = getNum(b);

            if (a1 > b1) {
                return 1;
            } else if (a1 < b1) {
                return -1;
            } else {
                return (int) (a - b);
            }
        });

        for (Long c : arr) {
            System.out.print(c + " ");
        }

        scan.close();
    }


    public static int getNum(long num) {
        // 计算num的个数
        String numStr = num + "";
        int count = 0;
        for (int i = 0; i < numStr.length(); i++) {
            int a = numStr.charAt(i) - '0';
            if (a == 8) {
                count += 2;
            }
            if (a == 0 || a == 4 || a == 6 || a == 9) {
                count++;
            }
        }
        return count;
    }

    /**
     * 日期函数
     */
    public static void date() {
        LocalDate start = LocalDate.of(2000, 12, 1);
        LocalDate end = LocalDate.of(2025, 12, 31);
        int count = 0;
        while (!start.isAfter(end)) {

            System.out.println(start);
            int dayOfWeek = start.getDayOfWeek().getValue();
            System.out.println("dayOfWeek = " + dayOfWeek);
            int dayOfMonth = start.getDayOfMonth();
            System.out.println("dayOfMonth = " + dayOfMonth);
            int dayOfYear = start.getDayOfYear();
            System.out.println("dayOfYear = " + dayOfYear);
            start = start.plusDays(1);
            count++;
        }
        System.out.println("-------------");
        System.out.println("count = " + count);


    }

    /**
     * 最大公约数
     */
    public static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    /**
     * 最小公倍数
     */
    public static int lcm(int a, int b) {
        return a * b / gcd(a, b);
    }

    /**
     * map
     */
    public static void mapOP() {
        Map<Integer, Integer> map = new HashMap<>();
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        for (int i = 0; i < n; i++) {
            int id = scan.nextInt();
            map.put(id, map.getOrDefault(id, 0) + 1);
        }

    }

    /**
     * Set
     */
    public static void setOP() {
        Set<String> set = new HashSet<>();
        set.add("java");
        set.add("python");
        set.add("c++");
        set.add("java");
        for (String s : set) {
            System.out.println(s);
        }
        System.out.println("-------------");
        if (set.contains("java")) {
            System.out.println("java 存在");
        }
    }

    /**
     * Arrays List
     */
    public static void arrayList() {
        List<String> list = new ArrayList<>();
        list.add("java");
        list.add("python");
        list.add("c++");
        for (String s : list) {
            System.out.println(s);
        }
        String str = list.get(0);
        System.out.println(str);
        System.out.println("-------------");
        String remove = list.remove(0);
        for (String s : list) {
            System.out.println(s);
        }
    }

    /**
     * 数组和集合
     */
    public static void arrayOP() {
        Integer[] arr = {10, 21, 3, 14, 5};
        int[] arr1 = new int[10];
        Arrays.sort(arr);
        for (Integer integer : arr) {
            System.out.print(integer + " ");
        }
        System.out.println();
        Arrays.fill(arr1, -1);
        for (int i : arr1) {
            System.out.print(i + " ");
        }
    }

    /**
     * 字符串
     */
    public static void stringOP() {
        String str = "hello world";
        String str1 = "hello WORLD";
        System.out.println(str.length());
        System.out.println(str.charAt(0));
        int i = str.indexOf(" ");
        System.out.println(i);
        System.out.println(str.substring(0, i));
        System.out.println(str.substring(i + 1));
        System.out.println(str1.toLowerCase());

        System.out.println(str.replace(" ", "123"));
        System.out.println(str.equals(str1));
        System.out.println(str.equalsIgnoreCase(str1));

        System.out.println("---------------");
        StringBuilder sb = new StringBuilder("luqi");
        System.out.println(sb);
        sb.append("hello").append(" ").append("world");
        System.out.println(sb);
        System.out.println(sb.reverse());
        System.out.println(sb.delete(0, 5));
        System.out.println(sb.insert(0, "hello"));
        System.out.println(sb.replace(0, 5, "world"));
        System.out.println(sb.capacity());

        System.out.println(sb);
    }

    /**
     * 浮点数
     */
    public static void floatNum() {
        double a = 3.1592;
        int b = 1;
        System.out.printf("%.2f", a);
        System.out.println();
        System.out.printf("%02d", b);
        System.out.println();

        BigDecimal bigDecimal = new BigDecimal("1.235");
        System.out.println(bigDecimal);
        BigDecimal b1 = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);
        System.out.println(b1);
    }

    /**
     * 判断次方
     */
    public static boolean isPower(long a, long b) {
        while (true) {
            if (a == 1) {
                return true;
            }
            if (a % b != 0) {
                return false;
            }
            a /= b;
        }
    }

    /**
     * 劲舞
     */
    public static void dancer() {

    }
}
